package org.lifxue.jqda;

import javax.swing.JDialog;
import javax.swing.SwingUtilities;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.lifxue.jqda.jintellitype.GlobalHotkeyResourceManagement;
import org.lifxue.jqda.ui.TrayPopupMenu;
import org.lifxue.jqda.util.GlobalVar;
import org.lifxue.jqda.util.InstanceRunning;
import org.lifxue.jqda.ui.util.UIUtil;

/**
 * Hello world!
 *
 */
public class App {

    private static Log logger = LogFactory.getLog(App.class);

    public App() {
        //初始化系统变量
        GlobalVar.init();
        InstanceRunning.isInstanceRunning();//判断单进程

        //系统热键
        GlobalHotkeyResourceManagement.initResources();
        GlobalHotkeyResourceManagement.addListener();
    }

    public static void main(String[] args) {

        //JFrame.setDefaultLookAndFeelDecorated(true);
        JDialog.setDefaultLookAndFeelDecorated(true);

        App app = new App();

        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                UIUtil.setUI();//设置LOOK_AND_FEEL
                TrayPopupMenu trayPopupMenu = new TrayPopupMenu();
                trayPopupMenu.tray();
            }
        });

    }
}
